package com.zjeav.lingjiao.ui.register;

import com.zjeav.lingjiao.base.baseBean.Result;
import com.zjeav.lingjiao.base.request.ChanageMobileRequest;
import com.zjeav.lingjiao.base.request.RegisterRequest;
import com.zjeav.lingjiao.base.request.ValidateCode;
import com.zjeav.lingjiao.base.response.ValidateCodeResponse;

public class RegisterPresenter implements CodeModel.OnCodeListener {
    CodeModel model;
    RegisterView view;

    public RegisterPresenter(RegisterView view) {
        this.model = new CodeModel();
        this.view = view;
    }

    public void getCode(ValidateCode phone) {
        this.model.getCode(phone, this);
    }
    public void register(RegisterRequest resquest){
        this.model.register(resquest,this);
    }

    public void chanagemobile(ChanageMobileRequest resquest){
        this.model.chanagemobile(resquest,this);
    }

    @Override
    public void OnSuccess(ValidateCodeResponse result) {
        view.showCodeSuccess(result);
    }

    @Override
    public void OnFailure(Throwable throwable) {
        view.showCodeFail();
    }

    @Override
    public void RegisterSuccess(Result result) {
        this.view.registerSuccess(result);
    }

    @Override
    public void RegisterFail(Throwable throwable) {

    }
}
